<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const obj = {
        [Symbol.toPrimitive]: function (hint) {
          // console.log(hint);
          return 100;
        },
      };
      obj[Symbol.toPrimitive](123);
      Number(obj); //obj[Symbol.toPrimitive](number);
      String(obj); //obj[Symbol.toPrimitive](string);
      obj + 100;
    </script>
  </body>
</html>
